<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>管理用户</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript">
	function gotoPage(name){
		var str=document.getElementById(name);
		var str2=str.getAttribute("id");
		if(str2=="first"){
			var url="admin/getAllUser?pageNow="+1+"&pageSize="+${pageSize}+"&finds=${request.finds}";
			document.location.href=url;
		}
		else if(str2=="back")
		{
			if(${pageNow>1}){
				var url="admin/getAllUser?pageNow="+${pageNow-1}+"&pageSize="+${pageSize}+"&finds=${request.finds}";
				document.location.href=url;
			}
		}
		else if(str2=="next"){
			if(${pageNow<pageCount}){
				var url="admin/getAllUser?pageNow="+${pageNow+1}+"&pageSize="+${pageSize}+"&finds=${request.finds}";
				document.location.href=url;
			}
		}
		else if(str2="last"){
			var url="admin/getAllUser?pageNow="+${pageCount}+"&pageSize="+${pageSize}+"&finds=${request.finds}";
			document.location.href=url;
		}
	}
</script>

</head>

<body>
	<form id="form1" name="form1" method="post" action="admin/getAllUser">
		<label id="ss1"> <input name="finds" type="text" size="20" />
		</label> <input type="submit" name="Submit" value="搜索" />
	</form>
	<c:if test="${!empty err}">
			<div id="login">
			<font color="#FF0000">${err }</font>
		</div>
	</c:if>
	<a href="admin/gotoIndex">返回主页</a>
	<table width="822" border="1">
		<tbody>
			<tr>
				<td width="160">ID</td>
				<td width="136">用户名</td>
				<td width="108">姓名</td>
				<td width="152">邮箱</td>
				<td width="126">电话</td>
				<td width="52">编辑</td>
				<td width="42">删除</td>
			</tr>
			<c:forEach items="${request.list}" var="user">
				<tr>
				<td>${user.id }</td>
				<td>${user.username }</td>
				<td>${user.name }</td>
				<td>${user.email}</td>
				<td>${user.tel}</td>
				<td><a href="admin/gotoUpUserData?user.id=${user.id}">编辑</a></td>
				<td><a href="admin/delUser?user.id=${user.id }" onclick="return window.confirm('确认删除？')">删除</a></td>
			</tr>
			</c:forEach>
			
			
		</tbody>
	</table>
	<div style="width:740px;margin-top: 30px;text-align: center;">
		当前页数 ${ pageNow} /总页数 ${ pageCount} 每页记录 ${ pageSize}/总记录 ${ rowsCount}<br />
		<input name="first" id="first" type="button" value="首页"
			onclick="gotoPage(this.name);" /><input id="back" name="back"
			type="button" value="上页" onclick="gotoPage(this.name)" /> <input
			id="next" name="next" type="button" value="下页"
			onclick="gotoPage(this.name)" /><input id="last" name="last"
			type="button" value="末页" onclick="gotoPage(this.name)" />
	</div>
</body>
</html>
